# $Id$
# Maintainer: Jan de Groot <jgc@archlinux.org>

pkgname=imake
pkgver=1.0.7
pkgrel=2
pkgdesc="X.Org imake program and related utilities"
arch=('i686' 'x86_64')
url="https://xorg.freedesktop.org/"
license=('custom')
depends=('glibc')
makedepends=('pkgconfig' 'xproto' 'perl' 'xorg-util-macros' 'xorg-font-util')
optdepends=('perl: for mkhtmlindex')
validpgpkeys=('4A193C06D35E7C670FA4EF0BA2FB9E081F2D130E') #Alan Coopersmith <alan.coopersmith@oracle.com>
source=(https://xorg.freedesktop.org/releases/individual/util/imake-${pkgver}.tar.bz2
        https://xorg.freedesktop.org/releases/individual/util/gccmakedep-1.0.3.tar.bz2
        https://xorg.freedesktop.org/releases/individual/util/lndir-1.0.3.tar.bz2
        https://xorg.freedesktop.org/releases/individual/util/makedepend-1.0.5.tar.bz2
        https://xorg.freedesktop.org/releases/individual/util/xorg-cf-files-1.0.6.tar.bz2{,.sig}
        linuxconfig.patch
        LICENSE)
sha256sums=('690c2c4ac1fad2470a5ea73156cf930b8040dc821a0da4e322014a42c045f37e'
            'b275dcf1f7323ed89e8b36f8fbd5da665d8700005f1779fa5b90a1688bbf2ee4'
            '49f4fab0de8d418db4ce80dad34e9b879a4199f3e554253a8e1ab68f7c7cb65d'
            'f7a80575f3724ac3d9b19eaeab802892ece7e4b0061dd6425b4b789353e25425'
            '4dcf5a9dbe3c6ecb9d2dd05e629b3d373eae9ba12d13942df87107fdc1b3934d'
            'SKIP'
            '1aa503f9a78e3d3b87b26aca15798825a7190cdedfcfa3e8ef850487a7bd45d3'
            '507f58781329532b9177ce21f8d4212a3146903eaa3aaf8472453d65f267b1bc')

prepare() {
  cd xorg-cf-files-1.0.6
  patch -p1 -i ../linuxconfig.patch
}

build() {
  for i in *; do
    if [ -d "${i}" ]; then
      pushd "${i}"
      autoreconf -fi
      ./configure --prefix=/usr --mandir=/usr/share/man
      make
      popd
    fi
  done
}

package() {
  for i in *; do
    if [ -d "${i}" ]; then
      pushd "${i}"
      make DESTDIR="${pkgdir}" install
      popd
    fi
  done
  install -D -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
